package com.zrt.pad.network.response;

import org.json.JSONArray;
import org.json.JSONObject;

import com.zrt.pad.datasource.bean.SysOption;

public class WebReturn {
	private Boolean succeed;
	private String message;
	private JSONArray data;
	private int succedFlag;
	
	public WebReturn(){
		
	}
	
	public WebReturn initWithJSON(JSONObject json) {
		WebReturn rtn = new WebReturn();
		try {
			rtn.succeed = json.getBoolean("succeed");
			rtn.message = json.getString("errorInfo");
			if (!json.isNull("returnInfo") && json.getString("returnInfo") != null)
			{
				String myJsonArray = json.getString("returnInfo");
				if(!myJsonArray.equals(""))
				{
					rtn.data = new JSONArray(myJsonArray);
				}
				else
				{
					rtn.data = null;
				}
			}
			else
			{
				rtn.data = null;
			}
			rtn.succedFlag = json.getInt("succedFlag");

		} catch (Exception e) {
			e.printStackTrace();
		}
		return rtn;
	}
	
	public JSONArray getData() {
		return data;
	}

	public void setData(JSONArray data) {
		this.data = data;
	}

	
	public Boolean getSucceed() {
		return succeed;
	}
	public void setSucceed(Boolean succeed) {
		this.succeed = succeed;
	}
	
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}

	public int getSuccedFlag() {
		return succedFlag;
	}

	public void setSuccedFlag(int succedFlag) {
		this.succedFlag = succedFlag;
	}
}